package com.kfm.spring.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

@Controller
public class MethodController {

    @RequestMapping(value =  "/method", method = RequestMethod.GET)
    public String getMethod(Integer id, HttpServletRequest request){
        System.out.println(request.getMethod());
        System.out.println(id);
        return "hello";
    }

    @RequestMapping(value =  "/method", method = RequestMethod.POST)
    public String postMethod(Integer id, HttpServletRequest request){
        System.out.println(request.getMethod());
        System.out.println(id);
        return "hello";
    }

    @RequestMapping(value =  "/method", method = RequestMethod.PUT)
    public String putMethod(Integer id, HttpServletRequest request){
        System.out.println(request.getMethod());
        System.out.println(id);
        return "hello";
    }

    @RequestMapping(value =  "/method", method = RequestMethod.DELETE)
    public String deleteMethod(Integer id, HttpServletRequest request){
        System.out.println(request.getMethod());
        System.out.println(id);
        return "hello";
    }
}

